package com.mengshuai.mysql.service.impl;

import com.mengshuai.mysql.bean.Person;
import com.mengshuai.mysql.mapper.PersonMapper;
import com.mengshuai.mysql.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 孟帅
 * @since 2024/11/15
 */
@Service
public class PersonServiceImpl implements IPersonService {
    @Autowired
    private PersonMapper personMapper;

    @Override
    public Person getPersonById(int id) {
        return personMapper.getPersonById(id);
    }

    @Override
    public void insert(Person person) {
        personMapper.insert(person);
    }

    @Override
    @Transactional
    public void insert1(Person person) {
        personMapper.insert(person);
        int a = 1/0;
        System.out.println("end");
    }
}
